<extend name="Base/common"/>
<block name="body">
<style type="text/css">
	.unm{
	width: 40px;
    height: 38px;
    text-align: center;
    line-height: 38px;
    border: 0;
    overflow: hidden;
	}
</style>
		<!--咨询-->
		<div id="order">
			<header><a href="__MODULE__/UserMember/userDetail/uid/{$Think.get.uid}/teaching/{$Think.get.teaching}/label/{$Think.get.label}/sex/{$Think.get.sex}/age/{$Think.get.age}/identity/{$Think.get.identity}/area_pid/{$Think.get.area_pid}/area_cid/{$Think.get.area_cid}/star/{$Think.get.star}/addtime/{$Think.get.addtime}/salary/{$Think.get.salary}/keywords/{$Think.get.keywords}" class="back"><img src="__IMG__/images/back_03.png"/></a>预约</header>
			<form action="__CONTROLLER__/successful" method="post">
			<div class="orderList">
				<ul>
					<!-- <li>
						<span class="f-fl">姓名</span>
						<span class="f-fr">张璇</span>
					</li> -->
					<li>
						<span class="f-fl">课酬</span>
						<span class="f-fr money"></span>
					<input type="hidden" name="salary" class="mmm" value=""><!-- 课程单价 -->
					</li>
					<li class="xueke">
						<span class="f-fl">学习内容</span>
						<volist name="courses" id="v">
							<a class="f-fr input title" data="{$v.salary}" aa="{$v.id}">{$v.title}</a>
							<input type="hidden" name="id" class="xx" value=""><!-- 课程id -->
						</volist>
						</li>
					<li>
						<span class="f-fl">课时</span>
						<div class="f-fr Class">
							<a class="short MOren">-</a>
							<input type="text" name="num" class="num shz" value="1" onblur="change_price()" >
							<a class="add">+</a>
						</div>
					</li>
					<li class="showBox">
						<span class="f-fl">联系方式</span>
						<span class="f-fr"> {$user.mobile}</span>
					</li>
				</ul>
				<p class="price">总计：<span class="sumprice">￥200</span></p>
				<input type="hidden" name="price" value="">
				<p style="text-align: left;padding: 0 30px;font-size: 18px;line-height: 25px;color: gray;">tips：所有的诈骗行为均发生于线下交易，对此我们深感痛心但无能为力，如您选择在平台上交易，我们承诺会对您的信息和财产负责，并不会对您收取任何费用。</p>
				<input type="submit"  id="btn" value="提交" />
			</div>
			<div class="hidebox">
				<ul class="orderUl">
					<li><strong>手机号码:</strong><input type="text" name="mobile" value="{$user.mobile}" style="margin-left: 11px;height: 52px;line-height: 52px"> <img src="__IMG__/images/choseed_03.jpg"/></li>
					<!-- <li><strong>微信</strong><span><input type="text name="wechat""></span> <img src="__IMG__/images/choseed_03.jpg"/></li>
					<li><strong>QQ</strong><span><input type="text" name="qq"></span> <img src="__IMG__/images/choseed_03.jpg"/></li> -->
					<li class="sure"><input type="button" value="确定" style="width: 30%;background: #4ea3fd;color: #fff;line-height: 28px;border: 0;height: 50px;"></li>
				</ul>
			</div>
		</div>
		<!-- <input type="hidden" class="idd" name="id" value="" /> 课程id --> 
		<input type="hidden" name="title" value="" /><!-- 课程标题 -->
		<input type="hidden" name="tid" value="{$tid}" /><!-- 教师id -->
		<input type="hidden" name="account" value="{$user.account}" /> 
		</form>
<script type="text/javascript">
	$('.sure input').click(function() {
		$('.showBox .f-fr').html($('.orderUl input[name=mobile]').val());
	});
	$('.title').click(function(){
		var price = $(this).attr('data');
		// $('.price').val(price);
		$('input[name=price]').val(price);
		$('.num').val(1);
		$('.sumprice').val(price);
		$('.idd').val($(this).attr('aa'));

		$('input[name=title]').val($(this).html());
	});
	$(function(){
		var str = $(".xueke a").last().attr('data');
		$('.mmm').val(str);
		$('.money').html(str+'元/时');
		$(".xueke a").last().addClass('moren1');
		$('.sumprice').html('￥'+str);
		$('input[name=price]').val(str);
		$('.xx').val($(".xueke a").last().attr('aa'));
		$('input[name=title]').val($('.xueke a').last().html());
		$('.idd').val($('.title').attr('aa'));
		// console.log($('.xueke a').last().html())
	});

	$('form').submit(function(){
		var mobile = $('input[name=mobile]').val()
		if (mobile == '') {
			layer.msg('请填写联系方式',{time:1000},function(){
				$('.hidebox').show().find('input[type=text]').focus();
			});
			return false;
		} else {
			var pattern = /^1[34578]\d{9}$/;
			if (pattern.test(mobile) != true) {
				layer.msg('手机号格式不正确',{time:1500},function(){
					$('.hidebox').show().find('input[type=text]').focus();
				});
				return false;
			}
		}
	})
	
	
	/*增加填写输入框是价格变动*/
	function change_price(){
	
		if($('.shz').val()<=0){
			$('.shz').val(1);
		}
		var jiage=$('.mmm').val();
		var keshi=$('.shz').val();
		$('.sumprice').html('￥'+(jiage*100)*keshi/100);
		$('input[name=price]').val((jiage*100)*keshi/100);
		
	}
</script>

</block>
